import sys
file=sys.stdout
file.write('hello world')

print('hello world')

file=open('10.txt','rb')
print(file.read(3))
print(file.tell())
print(file.seek(2,1))

with open('10.txt','r') as file2:
    print(file2.read())

with open('10.txt','r',encoding='utf-8') as file2:
    list1=file2.readlines()
    print(list1)

# 清空之前文件内容，重新写入内容(覆盖)
str1='day day up'
with open('10.txt','w',encoding='utf-8') as file3:
    file3.write(str1)

list3=['  &&  ','good good study']
with open('10.txt','a',encoding='utf-8') as file4:
    file4.writelines(list3)

